﻿using AutoMapper;
using OF.Component.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using User.Api.Models;

namespace User.Api
{
    /// <summary>
    /// 对象映射
    /// </summary>
    public class AutoMapperConfig
    {
        /// <summary>
        /// 映射
        /// </summary>
        public static void RegisterMappings()
        {
            Mapper.Initialize(cfg =>
            {
                //用户来源
                cfg.CreateMap<RequestUserSourceAdd, UserSourceInfo>();
                cfg.CreateMap<UserSourceInfo, ResponseUserSourceGet>();

                //用户
                cfg.CreateMap<RequestUserAdd, UserInfo>();
                cfg.CreateMap<RequestUserUpdate, UserInfo>();
                cfg.CreateMap<UserInfo, ResponseUserGet>();

                //用户认证
                cfg.CreateMap<RequestUserAuthAdd, UserAuthInfo>();
                cfg.CreateMap<RequestUserAuthVideoAdd, UserAuthInfo>();
                cfg.CreateMap<RequestUserAuthUpdate, UserAuthInfo>();
                cfg.CreateMap<UserAuthInfo, ResponseUserAuthGet>();

                //身份证
                cfg.CreateMap<ReqIDCardAdd, IDCardInfo>();
                cfg.CreateMap<ReqIDCardUpdate, IDCardInfo>();                
                cfg.CreateMap<IDCardInfo, ResIDCardGet>();

                //用户地址
                cfg.CreateMap<RequestMailAddressAdd, MailAddressInfo>();
                cfg.CreateMap<RequestMailAddressUpdate, MailAddressInfo>();
                cfg.CreateMap<MailAddressInfo, ResponseMailAddressGet>();
            });
        }
    }
}